import Vue from 'vue'
import request from '@/itsoftUI/utils/request'
import qs from "qs";
const baseUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/apartment";
//房间管理
const apiLateRecord = {
    // 晚归
    getLateReturnRecordList: function(search, page, order,fields) {
        const data = { search, page, order,fields}
        return request({
            url: baseUrl + "/lateReturnRecord/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 晚出
    getLateNightRecordList: function(search,page,order,fields) {
        const data = { search,page,order,fields}
        return request({
            url: baseUrl + "/lateOutRecord/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 未归
    getNotBackRecordList: function(search, page, order) {
        const data = { search, page, order }
        return request({
            url: baseUrl + "/notBackRecord/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 未入
    getNotInRecordList: function(search, page, order,fields) {
        const data = { search, page, order,fields }
        return request({
            url: baseUrl + "/notInRecord/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 未归预警
    getNotOutRecordList: function(search, page, order) {
        const data = { search, page, order }
        return request({
            url: baseUrl + "/notOutRecord/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 预警处理
    getWarningHandleList: function(search, page, order) {
        const data = { search, page, order }
        return request({
            url: baseUrl + "/earlyWarningHistory/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 楼宇/学院/班级
    getAuthList: function(collegeId) {
        const data = { collegeId }
        return request({
            url: baseUrl + "/roleDataAuth/getAuthList",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 学院
    getManageCollegeList: function() {
        const data = {}
        return request({
            url: baseUrl + "/manageCollege/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 预警原因
    getWarnReasonList: function(search) {
        const data = {
            search,
        }
        return request({
            url: baseUrl + "/manageDictionaryDetail/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 未归删除
    delNotInRecord: function(ids) {
        const data = {
            ids,
        }
        return request({
            url: baseUrl + "/notInRecord/delete",
            method: "post",
            data: qs.stringify(data)
        });
    },
    delNotOutRecord: function(ids) {
        const data = {
            ids,
        }
        return request({
            url: baseUrl + "/notOutRecord/delete",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 预警处理保存
    SaveWarnHandle: function(data) {
        const config = {
            headers: { 'Content-Type': 'application/json;charset=utf-8' },
        }
        return request.post(baseUrl + '/earlyWarningHistory/save', data, config)
    },
    countSafety: function(times,type) {
        const data = {
            times,type
        }
        return request({
            url: baseUrl + "/lateReturnRecord/countSafety",
            method: "post",
            data: qs.stringify(data)
        });
    },

}
export {
    apiLateRecord
}